package com.taoxi.order.mapper;

import com.taoxi.order.domain.Order;
import com.taoxi.order.domain.OrderItem;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface OrderMapperAgain {
    @Select("select * from `order`")
    @Results({
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "updateTime",column = "update_time"),
    })
    public List<Order> getorder();
    @Select({
            "<script>",
            "SELECT * FROM `order`",
            "LIMIT #{offset}, #{limit}",
            "</script>"
    })
    @Results({
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "updateTime",column = "update_time"),
    })
    List<Order> getorderlist(@Param("offset") int offset, @Param("limit") int limit);
    @Select("SELECT COUNT(*) FROM `order`")
    public int countOrders();

    @Select("select * from order_item where order_id = #{orderid}")
    @Results({
            @Result(property = "goodId",column = "good_id"),
            @Result(property = "skuId",column = "sku_id"),
            @Result(property = "categoryId",column = "category_id"),
            @Result(property = "orderId",column = "order_id"),
            @Result(property = "logisticsId",column = "logistics_id"),
            @Result(property = "imageUrl",column = "image_url"),
            @Result(property = "createTime",column = "create_time"),
            @Result(property = "payTime",column = "pay_time"),
    })
    public List<OrderItem> getorderdetail(@Param(value = "orderid")int orderid);

}

